﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace UserControls
{
    public partial class LocalRepositoryPathUC : UserControl
    {
        string path;

        public string Path
        {
            get { return path; }
            set { path = value; }
        }

        public LocalRepositoryPathUC()
        {
            InitializeComponent();
        }

        private void buttonBrowse_Click(object sender, EventArgs e)
        {
            this.path = string.Empty;

            FolderBrowserDialog myFolderBrowserDlg = new FolderBrowserDialog();
            myFolderBrowserDlg.Description = "Locate the path of the local repository.";
            if (myFolderBrowserDlg.ShowDialog() == DialogResult.OK)
            {
                this.path = myFolderBrowserDlg.SelectedPath;
                this.textBoxLocalRepositoryPath.Text = path;
            }

        }

        public string GetPath()
        {
            if (Directory.Exists(this.textBoxLocalRepositoryPath.Text))
            {
                return this.textBoxLocalRepositoryPath.Text;
            }
            return string.Empty;
        }
    }
}
